package javaTest;

public class Vehicle {
    private double speed;
    private int size;

    //移动方法
    public void move() {
        System.out.println("正在以" + speed + "速度移动");
    }

    //加速
    public void speedUp() {
        System.out.println("加速到" + (speed + 10) + "米每秒");
    }

    //减速
    public void speedDown() {
        System.out.println("减速到" + (speed - 10) + "米每秒");

    }

    public double getSpeed() {
        return speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public Vehicle(double speed, int size) {
        this.speed = speed;
        this.size = size;
    }

    public Vehicle() {
    }
}
